﻿@model IList<ProductOverviewModel>
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.RecentlyAddedProducts").Text);
}
@using Nop.Web.Models.Catalog;
<div class="page recently-added-products-page">
    <div class="page-title">
        <a href="@Url.RouteUrl("RecentlyAddedProductsRSS")" class="link-rss" title="@T("Products.NewProducts.RSS.Hint")">@T("Products.NewProducts.RSS")</a>
        <h1>@T("Products.NewProducts")</h1>
    </div>
    <div class="page-body clearfix">
        @if (Model.Count > 0)
        {
            <div class="product-grid" id="recently-added-products">
                @foreach (var product in Model)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>
            <script type="text/javascript">
                seajs.use("common/1.0.0/index", function (app) {
                    app(function () {
                        app("#recently-added-products").on("click", ".product-box-add-to-cart-button", function (evt) {
                            evt.preventDefault();
                            var add2cartLink = app(this).data("addcartlink");
                            app.ajaxCart.addproducttocart_catalog(add2cartLink);
                        });
                    });
                });
            </script>
        }
    </div>
</div>
